import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { equipmentPropertyVO, equipmentPropertyForm, equipmentPropertyQuery } from '@/api/facility/equipment-property/types';

/**
 * 查询设备属性列表
 * @param query
 * @returns {*}
 */

export const listequipmentProperty = (query?: equipmentPropertyQuery): AxiosPromise<equipmentPropertyVO[]> => {
  return request({
    url: '/equipment/equipment-property/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备属性详细
 * @param equipmentPropertyId
 */
export const getequipmentProperty = (equipmentPropertyId: string | number): AxiosPromise<equipmentPropertyVO> => {
  return request({
    url: '/equipment/equipment-property/' + equipmentPropertyId,
    method: 'get'
  });
};

/**
 * 新增设备属性
 * @param data
 */
export const addequipmentProperty = (data: equipmentPropertyForm) => {
  return request({
    url: '/equipment/equipment-property',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备属性
 * @param data
 */
export const updateequipmentProperty = (data: equipmentPropertyForm) => {
  return request({
    url: '/equipment/equipment-property',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备属性
 * @param equipmentPropertyId
 */
export const delequipmentProperty = (equipmentPropertyId: string | number | Array<string | number>) => {
  return request({
    url: '/equipment/equipment-property/' + equipmentPropertyId,
    method: 'delete'
  });
};
